﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ERP_RORZE_TOOL.Common.ValueObject;
using ERP_RORZE_TOOL.DBAccess;

namespace ERP_RORZE_TOOL.BizLogic
{
	public class BorrowHelper
	{
		private Borrow obj;

		#region BorrowHelper(Borrow obj)
		public BorrowHelper(Borrow obj)
		{
			ValueObject = obj;
		}
		#endregion

		//
		#region ValueObject
		public Borrow ValueObject
		{
			get
			{
				return obj;
			}
			set
			{
				obj = value;
			}
		}
		#endregion

		public DataTable GetAll(int range)
		{
            DataTable dt = BorrowDAO.GetAll(range);
			return dt;
		}

		public DataTable GetOne()
		{
			DataTable dt = BorrowDAO.GetOne(ValueObject.ID);
			return dt;
		}

        public void LoadOne()
		{
			ValueObject = BorrowDAO.LoadOne(ValueObject.ID);
		}

		public int Insert()
		{
			int result = BorrowDAO.Insert(ValueObject);
			return result;
		}

		public int Update()
		{
			int result = BorrowDAO.Update(ValueObject);
			return result;
		}

		public int Delete()
		{
			int result = BorrowDAO.Delete(ValueObject);
			return result;
		}
	}
}
